package com.example.message_wall_spring.controller;

import com.example.message_wall_spring.service.MessageInfoService;
import lombok.extern.slf4j.Slf4j;
import com.example.message_wall_spring.mapper.MessageInfoMapper;
import com.example.message_wall_spring.model.MessageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequestMapping("/message")
@RestController
public class MessageInfoController {
    @Autowired
    private MessageInfoService messageInfoService;

    @RequestMapping("/publish")
    public boolean publish(MessageInfo messageInfo) {
        return messageInfoService.publish(messageInfo);
    }

    @RequestMapping("/getmessage")
    public List<MessageInfo> getMessage() {
        return messageInfoService.getMessage();
    }
}
